<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改运输方式代码')" />
    <th:block th:include="include :: ztree-css" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-role-edit" th:object="${transportation}">
        <!--<input id="routeId" name="routeId" type="hidden" th:field="*{routeId}"/>-->
        <div class="form-group">
            <label class="col-sm-3 control-label ">运输方式代码：</label>
            <div class="col-sm-8">
                <input class="form-control" type="text" disabled name="shipViaCode" id="shipViaCode" th:field="*{shipViaCode}" required  >
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label ">货运方式描述：</label>
            <div class="col-sm-8">
                <input class="form-control" type="text" name="description" id="description" th:field="*{description}" required>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">运输模式：</label>
            <div class="col-sm-8">
                <input id="forwardAgentId" name="modeOfTransport" class="form-control" th:field="*{modeOfTransport}" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label ">运输单位类型：</label>
            <div class="col-sm-8">
                <input class="form-control" type="text" name="transportUnitType" id="transportUnitType" th:field="*{transportUnitType}" required>
            </div>
        </div>
        <!--<div class="form-group">-->
            <!--<label class="col-sm-3 control-label ">运输单位类型：</label>-->
            <!--<div class="col-sm-8">-->
                <!--<input class="form-control" type="text" name="checkOnLineLevel" id="checkOnLineLevel" required>-->
            <!--</div>-->
        <!--</div>-->
    </form>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: ztree-js" />
<script type="text/javascript">
    // $("#form-role-add").validate({
    //     rules:{
    //         onkeyup: false,
    //         routeId:{
    //             remote: {
    //                 url: ctx + "goodsPath/checkRouteId",
    //                 type: "post",
    //                 dataType: "json",
    //                 data: {
    //                     "routeId" : function() {
    //                         return $.common.trim($("#routeId").val());
    //                     }
    //                 },
    //                 dataFilter: function(data, type) {
    //                     return $.validate.unique(data);
    //                 }
    //             }
    //         },
    //     },
    //     messages: {
    //         "routeId": {
    //             remote: "工艺路线标识已经存在"
    //         }
    //     },
    //     focusCleanup: true
    // });
    function submitHandler() {
        // if ($.validate.form()) {
            edit();
        // }
    }

    function edit() {
        var shipViaCode = $("input[name='shipViaCode']").val();
        var description = $("input[name='description']").val();
        var modeOfTransport = $("input[name='modeOfTransport']").val();
        var transportUnitType = $("input[name='transportUnitType']").val();
        $.ajax({
            cache : true,
            type : "POST",
            url : ctx + "transportation/edit",
            data : {
                "shipViaCode": shipViaCode,
                "description": description,
                "modeOfTransport": modeOfTransport,
                "transportUnitType": transportUnitType
            },
            async : false,
            error : function(request) {
                $.modal.alertError("系统错误");
            },
            success : function(data) {
                $.operate.successCallback(data);
            }
        });
    }
</script>
</body>
</html>
